﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="房产销冠, 房地产,卡考网络" />
    <meta name="description" content="上海卡考网络有限公司" />
    <title>房产销冠</title>
    <link rel="stylesheet" href="css/list.css" type="text/css" />
    <link rel="stylesheet" href="css/global.css" type="text/css" />
    <link href="bootstrap/iCheck-master/skins/minimal/Orange.css" rel="stylesheet" type="text/css" />
    <!--<script src="js/jquery-1.8.3.min.js"></script>-->
    <!--<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />-->
    <script src="http://dn-blqw.qbox.me/jq+bs+art.js" type="text/javascript"></script>
    <!--<script src="js/jquery.easydropdown.min.js"></script>-->
    <!--<script src="bootstrap/iCheck-master/icheck.js"></script>-->
    <!--<script src="bootstrap/js/bootstrap.min.js"></script>-->
    <!--<script src="js/checkbox.js"></script>-->
    <script src="js/common.js"></script>
    <script src="js/PageIndex.js"></script>
    <script src="http://dn-blqw.qbox.me/kk.js"></script>
    <script src="js/WdatePicker.js"></script>
    <!--<script src="http://static.tops001.com/openSource/iDialog/1.1/jquery.iDialog.js" dialog-theme="default"></script>-->
    <script src="Scripts/jquery.iDialog.js" dialog-theme="default"></script>
    <style>
        .from-control {width:350px;margin:10px 20px;}
    </style>
</head>
<body style="background: #f1f1f1;">
    <div class="main01">
        <div class="content clearfix">
            <div class="headline02">
                <div class="line_left">中奖记录 <span>(<b id="RecordCount">0</b>)</span></div>
                <div class="line_right">
                    <ul class="nav_line_right">
                        <li class="con"><a href="#">首页</a></li>
                        <li>/</li>
                        <li class="con"><a href="#">订单管理</a></li>
                        <li>/</li>
                        <li class="con"><a href="#" style="color: #60b12a;">中奖记录</a></li>
                    </ul>
                </div>
            </div>
            <div class="bton">
                <div class="bton_left">
                    <div class="bton_left_nav">
                        <select id="F_CityKid" class="selall sel100 fl" style="margin-right:11px">
                            <option value="-1">请选择</option>
                        </select>
                        <select id="selIsWin" class="selall sel100 fl" style="margin-right:11px">
                            <option value="-1">中奖状态</option>
                            <option value="0">未中奖</option>
                            <option value="1">已中奖</option>
                        </select>
                        <select id="selSendStatus" class="selall sel100" style="margin-right:11px">
                            <option value="-1">发放状态</option>
                            <option value="9">未发放</option>
                            <option value="10">已发放</option>
                        </select>                     
                    </div>
                    <!--<input type="button" value="搜索" class="sbtn fl" onclick="f_Seach()" />-->
                </div>
                <div class="bton_right">
                    <div class="bton_left_nav">
                        <a href="#" class="btn_export" onclick="f_ExportExcel()">导出</a>
                        <a href="" id="DownLoad" target="_blank" class="btn_export" style="display:none">下载</a>
                        <a href="" class="btn_select" id="selboxbt">筛选</a>
                        
                    </div>
                    <div class="bton_left_nav pageIn2">
                    </div>
                </div>
            </div>
        </div>
        <div style="min-height: 500px;">
            <div style="min-width: 800px; overflow: auto;">
                <table id="tableList" class="table01" style="width: 100%; max-height: 400px; table-layout: fixed; border-bottom: 1px #e6e6e6 solid;">
                    <thead>
                        <tr class="info_title">
                            <th style="width: 60px;">序号</th>
                            <th style="width: 150px;" class="mid_line">中奖礼品</th>
                            <th style="width: 100px;" class="mid_line">中奖状态</th>
                            <th style="width: 80px;" class="mid_line">姓名</th>
                            <th style="width: 100px;" class="mid_line">电话</th>
                            <th style="width: 200px" class="mid_line">公司</th>
                            <th class="mid_line" style="width:250px;">公司地址</th>
                            <th style="width: 150px" class="mid_line">时间</th>
                            <th style="width: 120px" class="mid_line">发放状态</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr class="info_cont" style="display: none">
                            <td>{F_Index}</td>
                            <td>{Name}</td>
                            <td>{IsWin}</td>
                            <td>{UserName}</td>
                            <td>{PhoneNumber}</td>
                            <td>{F_CompanyName}</td>
                            <td>{F_Address}</td>
                            <td>{CreateTime}</td>
                            <td>{IsSend}</td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <!--放置分页 begin -->
            <table style="width: 100%; height: auto">
                <tr>
                    <td colspan="15">
                        <div class="pageIn"></div>
                    </td>
                </tr>
            </table>
            <!--放置分页 end -->
        </div>
    </div>
    <div id="selbox" class="clearfix" style="display:none">
        <!--<label class="lab112 fl">
        <input type="checkbox" id="chkIsSend" />&nbsp;已发放
        </label>-->
        <input type="text" class="selall sel100 fl from-control" id="productName" placeholder="奖品名称" />
        <input type="text" class="selall sel100 fl from-control" id="brokerName" placeholder="经纪人姓名" />
        <input type="text" class="selall sel100 fl from-control" id="brokerPhone" placeholder="经纪人手机号" />
        
        <div class="datatime">
            <input type="text" id="startTime" value="" onclick="WdatePicker()" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" placeholder="请选择开始时间" style="line-height:28px;border:1px solid #e3e4e6" class="from-control" />
            <input type="text" id="endTime" value="" onclick="WdatePicker()" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd', minDate: '#F{$dp.$D(\'startTime\')}' })" placeholder="请选择结束时间" style="line-height:28px;border:1px solid #e3e4e6;" class="from-control" />
        </div>
    </div>
    <script type="text/javascript" src="js/list.js"></script>
    <script type="text/javascript">
        //获取商品类型
        function f_GetProductCategoryList() {
            $kk.api.get("/ProductsCategory/GetList", function (data) {
                if (data === undefined) {
                    location.href = "list.html";
                }
                $.each(data, function (i, obj) {
                    $("#F_CateogryKid").append("<option value='" + obj.Kid + "'>" + obj.F_CategoryName + "</option>");
                });
            });
        }

        $("#selSendStatus").change(function () {
            f_GetData();
        });

        $("#selIsWin").change(function () {
            f_GetData();
        });

        $("#F_CityKid").change(function () {
            f_GetData();
        });

        $("#selboxbt").click(function () {
            showWindows("高级搜索", "selbox", f_Seach, 800, 350);
            return false;
        })

        function showWindows(title, id, func, wt, h) {
            $.dialog({
                height: h,
                width: wt,
                fixed: true,
                lock: true,
                title: title,
                content: document.getElementById(id),
                btn: {                      //可以任意定义按钮个数
                    ok: {                     //按钮的key值，下次可用个btn方法从新设置
                        val: '确定',  //按钮显示的文本
                        type: 'orange',
                        click: function () {
                            func();
                        }
                    },
                    canle: {                     //按钮的key值，下次可用个btn方法从新设置
                        val: '取消',
                    }
                },
                init: function () {

                },
            });

        }
        var PageIndex = 1;

        function f_Seach() {
            pageIndex = 1;
            f_GetData(pageIndex);
        }
        //获取商品详细
        function f_GetData(pageIndex) {
            var pageSize = 8;
            var idx = 0;
            var newUrlParStr = f_UrlParStr();
            $kk.api.get("/LuckBigTurntable/GetLuckList" + newUrlParStr, { pageSize: pageSize, pageIndex: pageIndex }, function (res) {
                kk.fillTable(".table01", res.Items, function (data, name) {
                    switch (name) {
                        case "F_Index":
                            idx++;
                            var otherCount = pageSize * (pageIndex - 1);
                            if (isNaN(otherCount)) {
                                otherCount = 0;
                            }
                            return idx + otherCount;
                        case "IsSend":
                            switch (data["IsSend"]) {
                                case 1:
                                case 2:
                                case 3:
                                case 4:
                                case 5:
                                case 6:
                                case 7:
                                case 8:
                                case 9:
                                    if (data["IsWin"]) {
                                        return "<a href=\"javascript:;\" onclick=\"f_Send(" + data["Kid"] + ")\">发放</a>";
                                    } else {
                                        return "已发放";
                                    }
                                    break;
                                case 10:
                                    return "已发放";
                                    break;
                            }
                            break;
                        case "IsWin":
                            if (data[name] == 1) {
                                return "已中奖";
                            } else {
                                return "未中奖";
                            }
                    }
                });
                $("#RecordCount").html(res.Count);
                makePageBar(f_GetData, res.Count, pageIndex, pageSize);

                PageIndex = pageIndex;
                //kk.drawing();
            });
        }

        function f_UrlParStr() {
            //var categoryKid = $("#F_CateogryKid option:selected").val();
            //if (isNaN(categoryKid) || categoryKid == "") {
            //    categoryKid = 0;
            //}
            //var stock = $("#F_Stock").prop("checked");
            //stock ? stock = 1 : stock = 0;
            //var keywords = $("#keyWord").val();
            var brokerName = $("#brokerName").val();
            var brokerPhone = $("#brokerPhone").val();
            var startTime = $("#startTime").val();
            var endTime = $("#endTime").val();
            //var isSend = $("#chkIsSend").prop("checked");
            //isSend ? isSend = 1 : isSend = 0;
            var isSend = $("#selSendStatus").val();
            var isWin = $("#selIsWin").val();
            var productName = $("#productName").val();
            var cityKid = $("#F_CityKid option:selected").val();
            if (cityKid == undefined) {
                cityKid = -1;
            }
            return "?brokerPhone=" + brokerPhone + "&brokerName=" + brokerName + "&startTime=" + startTime + "&endTime=" + endTime + "&isSend="
                + isSend + "&isWin=" + isWin + "&productName=" + productName + "&cityKid=" + cityKid;

        }

        function f_Send(val) {
            kk.confirm("确定此操作吗?", "提示", "", "", function () {
                $kk.api.get("/LuckBigTurntable/UpdateSendStatus", { id: val, isSend: 10 }, function (res) {
                    if (res) {
                        f_GetData(PageIndex);
                    } else {
                        kk.alert("操作失败");
                    }
                });
            });
        }

        $(function () {
            f_GetData();
            f_GetCityList();
        });
        function f_GetCityList() {
            var data = kk.api.get("/System/GetCityList", function (data) {
                $("#F_CityKid").empty();
                $.each(data, function (i, obj) {
                    $("#F_CityKid").append("<option value='" + obj.F_CityKid + "'>" + obj.F_CityName + "</option>");
                });
            });

        }

        function f_ExportExcel() {
            var newUrlParStr = f_UrlParStr();
            $kk.api.get("/LuckBigTurntable/Export" + newUrlParStr, function (res) {
                //window.location.href = window.location.host + res;
                //window.open(window.location.host + res)
                //$("#DownLoad").attr("href", window.location.host + res)
                $("#DownLoad").attr("href", res)
                $("#DownLoad").show();
            });
        }

    </script>
</body>
</html>
